package ATMproject;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Login extends JPanel implements ActionListener {
    //声明交互按钮
    private JButton loginBtn;

    private MainPage frame;

    private Icon loginButton = Util.getIcon("/atmimage/buttonLogin.jpg");


    public Login(MainPage frame) {
        this.frame = frame;

        this.setLayout(null);

        this.setOpaque(false);

        JLabel titleLabel = new JLabel("登录");
        titleLabel.setBounds(200, 50, 100, 50);
        this.add(titleLabel);

        //有交互的登录
        loginBtn = new JButton(loginButton);
        loginBtn.setBounds(350, 180, 100, 50);
        this.add(loginBtn);
        loginBtn.addActionListener(this);
    }


    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == loginBtn) {
            frame.switchPanel("menu");
        }

    }
}
